package com.hntech.base.juc.thread;

import java.util.concurrent.CyclicBarrier;

/**
 * @Autho changqi.wu
 * @Date 路在脚下，使劲踩！
 */
public class YealdThread2 {

    static int total = 10;
    static CyclicBarrier cdl = new CyclicBarrier(total);

    public static void main(String[] args) {
        countDownLatch();
    }

    public static void countDownLatch(){


        for(int i= 0;i < total ;i++){
            new Thread(new Work()).start();
        }

        try {
            cdl.await();
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("end");
    }



    public static class Work implements Runnable{

        @Override
        public void run() {
            System.out.println("out-put : " + Thread.currentThread().getName());
        }
    }
}
